<?php
/**
 * Created by PhpStorm.
 * User: fengdh
 * Date: 2019/8/5
 * Time: 14:58
 */

namespace business\company\models;

use business\base\models\BaseActiveRecord;

/**
 * @property int supplierId
 * @property string companyName //公司名称
 * @property string shortName //公司简称
 * @property string companyLogo //公司logo
 *
 * @property string establishYear //成立年份
 * @property string companyType //公司类型
 * @property string companyTypeName
 *
 * @property string legalName //法人姓名
 * @property string legalMobile //法人手机
 *
 * @property string licenseCode //营业执照号
 * @property string licenseFileId //营业执照图片id
 * @property string licenseFileName //营业执照图片名称
 *
 * @property int regCapital //注册资本
 * @property string regCapitalUnit //币种
 * @property int regCapitalCny //转换人民币的注册资本
 *
 * @property string iCCertificationUrl //工商认证网址
 * @property string iCCFileId //工商认证截图
 * @property string serviceCategoryCodes //提供的服务/产品分类编码
 * @property string serviceCategoryNames //提供的服务/产品分类编码名称
 * @property string customCategory //自定义-提供的服务/产品分类
 *
 * @property string mainServiceCodes //主营业务code（来自已选择服务分类）
 * @property string mainServiceNames //主营业务code名称（来自已选择服务分类）
 *
 * @property string regionCodeStr // 业务领域及规模(服务区域-code)
 * @property string regionNameStr //业务领域及规模(服务区域-Name)
 *
 * @property string businessScope //业务范围
 * @property string supplierType //供应商类型：取值来自数据字典
 * @property string supplierTypeName //供应商类型名称：工程，服务，厂商，总代，经销
 * @property string supplierIntro //公司简介信息
 *  ------公司联系信息----------------
 * @property string telephone //公司总机
 * @property string fax   //传真
 * @property string hotline  //服务热线
 *
 * ------- 公司地址-----------------
 * @property string provinceCode  //公司地址 省code
 * @property string provinceName  //公司地址 省name
 * @property string cityCode //公司地址 市code
 * @property string cityName //公司地址 市name
 * @property string address  //公司地址 街道地址
 *
 * @property string postcode  //邮编
 * @property string website  //企业网址
 * @property string blogAddress  //企业微博
 * @property string weixinPublicAccount  //微信公众号
 *
 * @property string sourceType
 * @property string showAuthTag
 *
 * --------公司联系人信息----
 * @property string contactName
 * @property string companyMobile
 * @property string companyEmail
 * @property string contactPosition
 * @property string contactTelephone
 *
 * @property string lastDisableReason
 *
 * @property string createdBy
 * @property string createdTime
 * @property string lastUpdatedBy
 * @property string lastUpdatedTime
 *
 * @property int state  //冻结状态：1:冻结，2：正常
 * @property int status //供应商是否已审核：0未审核、2已审核
 * @property int operationStatus //操作过程状态 1:无(正常),2:草稿中,3:审核中,4:版本还原中
 * @property string currentVersion //当前版本号
 *
 * @property SupplierServiceCategoryModel[] categoryCodeList 产品/服务分类
 * @property array qualifyList  供应商资质
 * @property array regionCodeList 服务区域
 * @property array projectList  项目案例
 * @property string supplierLevel  金牌供应商
 * @property string isFamous  是否知名企业
 * @property string unlimitedRegisterCount 是否验证报名次数  0 不验证 1 验证
 * @property int isTop 是否是供应商十强
 * @property int platinumFlag 是否是铂金会员
 * @property int diamondFlag 是否是钻石会员
 * @property int companyStatus 企业工商状态
 * @property int listedType 企业工商状态
 */
class SupplierBasicModel extends BaseActiveRecord
{
    /**
     * operationStatus //操作过程状态 1:无(正常),2:草稿中,3:审核中,4:版本还原中
     */
    const OPERATION_STATUS_NONE = 1;
    const OPERATION_STATUS_DRAFT = 2;
    const OPERATION_STATUS_AUDIT = 3;
    const OPERATION_STATUS_RESTORE = 4;

    /**
     * 冻结状态：1:冻结，2：正常
     */
    const STATE_FREEZED = 1;
    const STATE_NOT_FREEZED = 2;

    /**
     * 供应商是否已审核：0未审核、2已审核
     */
    const STATUS_NOT_ADUITED = 0;
    const STATUS_ADUITED = 2;

    /**
     * 供应商等级
     */
    const SUPPLIER_LEVEL_COMMON=0;
    const SUPPLIER_LEVEL_GOLD=1;



    //----非表相对应的字段信息----
    public $companyTypeName;

    public $licenseFileId;  //营业执照图片id
    public $licenseFileName; //营业执照图片名称

    public $serviceCategoryCodes; //提供的服务/产品分类编码
    public $serviceCategoryNames; //提供的服务/产品分类编码名称
    public $customCategory; //自定义-提供的服务/产品分类

    public $mainServiceCodes; //主营业务code（来自已选择服务分类）
    public $mainServiceNames; //主营业务code名称（来自已选择服务分类）

    public $regionCodeStr; // 业务领域及规模(服务区域-code)
    public $regionNameStr; //业务领域及规模(服务区域-Name)

    public $supplierTypeName; //供应商类型名称：工程，服务，厂商，总代，经销
    public $taxpayerScaleName = ""; //纳税资格
    public $supplierIntro; //公司简介信息

    public $provinceName;  //公司地址 省name

    public $cityName; //公司地址 市name

    public $version;

    public $auditStatus;

    private $_offset;

    private $_limit;

    public static function tableName()
    {
        return 'b2b_company.uuc_supplier_basic';
    }

    public $_fieldsAlias = [
        "supplierId" => "supplier_id",
        "companyName" => "company_name",
        "shortName"=>"short_name",
        "companyLogo"=>'company_logo',
        "establishYear" => "establish_year",
        'companyType'=>'company_type',
        'legalName'=>"legal_name",
        'legalMobile'=>"legal_mobile",
        "orgCode"=>"org_code",
        'licenseCode'=>"license_code",
        "regCapital" => "reg_capital",
        "regCapitalUnit" => "reg_capital_unit",
        "regCapitalCny" => "reg_capital_cny",

        "createdBy" => "created_by",
        "createdTime" => "created_time",
        "lastUpdatedBy"=>"last_updated_by",
        "lastUpdatedTime"=>"last_updated_time",

        "iCCertificationUrl"=>"ic_certification_url",
        "iCCFileId"=>"icc_file_Id",
        "businessScope" => "business_scope",
        "supplierType" => "supplier_type",
        "provinceCode" => "province_code",
        "cityCode" => "city_code",

        "regProvinceCode"=>"reg_province_code",
        "regCityCode"=>"reg_city_code",
        "regAddress"=>"reg_address",

        "blogAddress"=>"blog_address",
        "weixinPublicAccount"=>"weixin_public_account",

        "userLevel"=>"user_level",
        "sourceType"=>"source_type",

        "customCategory"=>"custom_category",
        "showAuthTag"=>"show_auth_tag",

        "contactName"=>"contact_name",
        "companyMobile"=>"company_mobile",
        "companyEmail"=>"company_email",
        "contactPosition"=>"contact_position",
        "contactTelephone"=>"contact_telephone",

        "lastDisableReason"=>"last_disable_reason",

        'operationStatus' => 'operation_status',
        'currentVersion'=>'current_version',
        'supplierLevel'=>'supplier_level',
        'isFamous'=>'is_famous',
        'unlimitedRegisterCount'=>'unlimited_register_count',

        'startTime' => 'start_time',
        'endTime' => 'end_time',
        'neverExpire' => 'never_expire',

        'isTop' => 'is_top',
        'platinumFlag' => 'platinum_flag',
        'diamondFlag' => 'diamond_flag',
        'regionalDiamondLevel' => 'regional_diamond_level',

        'companyStatus' => 'company_status', // 公司工商状态
        'listedType' => 'listed_type', // 上市状态
        'topTenCategory' => 'top_ten_category' // 峰会10强行业名称
    ];

    public $categoryCodeList;

    public $qualifyList;

    public  $regionCodeList;

    public  $projectList;

    public $companyAddressCodeList;

}